#ifndef FILE_PARSER_HPP
#define FILE_PARSER_HPP

#include "define.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/tokenizer.hpp>
#include <queue>
#include <list>
#include <map>

typedef std::pair<std::string, std::string> TagValue;
typedef std::pair<std::string, std::vector<std::string> > TagValues;

class FileParser
{
	public:
		// Get all animation of script
		static void AnimationFrame(const std::string &filename, const std::string typeName, std::vector<sf::IntRect> &listIntRect);

		// Get All Line
		static void AllLines(const std::string &filename, std::list<std::string> &lines);

		// Change value of Tag Name
		static void SetValue(const std::string &filename, const std::string tagName, const std::string &value);
		static void SetValue(const std::string &filename, const std::string tagName, const int &value);
		static void SetValue(const std::string &filename, const std::string tagName, const float &value);

		// Change several values
		static void SetValues(const std::string &filename, std::map<std::string, std::string> &values);

		// Get value of Tag Name
		static  int ValueToInt(const std::string &filename, const std::string tagName);
		static  float ValueToFloat(const std::string &filename, const std::string tagName);
		static  std::string ValueToString(const std::string &filename, const std::string tagName);
        static  void  AllTagValues(const std::string &filename, const std::string tagName, std::queue<TagValues> &values);

		// Get several values
        static void Values(const std::string &filename, const std::list<std::string> &listTagName, std::map<std::string, std::string> &values);
		static void Values(const std::string &filename, const std::vector<std::string> &listTagName, std::map<std::string, std::string> &values);

        // Get All Values
        static void AllValues(const std::string &filename, std::map<std::string, std::vector<std::string> > &values);
        static void AllValues(const std::string &filename, std::queue<TagValues> &values);

		///
		// Manipulate file

		// Create a new file
		static void CreateNewFile(const std::string &filename, const std::string &content = "");

		// Delete a file
		static void DeleteFile(const std::string &filename);

		// Rename a file
		static void RenameFile(const std::string &currentFilename, const std::string &newFilename);

		// Copy a file
		static void CopyFile(const std::string &source, const std::string  &filenameCopy);

		///
		// Conversion Type String to Number or Number to String

		// To Int
		static int ToInt(const std::string &value);

		// To String
		static std::string ToString(const int &value);
		static std::string ToString(const float &value);

		// To Float
		static float ToFloat(const std::string &value);

};

#endif
